package com.thrd.taiexhibition.adapter;

import android.content.Context;

import com.thrd.basicframework.bean.BaseRecyclerAdapter;
import com.thrd.taiexhibition.R;
import com.thrd.taiexhibition.bean.BeanThemeIe;
import com.thrd.taiexhibition.fresco.FrescoImage;
import com.thrd.taiexhibition.fresco.FrescoUtils;

import java.util.List;

/**
 * @author: ${唐杰}
 * @date: 2021/3/10
 */
public class ThemeExhibitionTopAdapter extends BaseRecyclerAdapter<BeanThemeIe> {

    public ThemeExhibitionTopAdapter(Context context, List<BeanThemeIe> data) {
        super(context, data);
    }

    @Override
    public void bindData(BaseViewHolder holder, BeanThemeIe beanThemeIe) {
        FrescoImage mFrescoImage= (FrescoImage) holder.getView(R.id.fi_image);
        FrescoUtils.getInstance().setPrefixProgressLoad(getContext(),mFrescoImage,beanThemeIe.getIeshowimg());

    }

    @Override
    public int getItemLayoutId() {
        return R.layout.item_theme_exhibition_top;
    }

//    private Context mContext;
//    private List<BeanThemeIe> list;
//    public ThemeExhibitionTopAdapter(Context mContext, List<BeanThemeIe> list){
//        this.list=list;
//        this.mContext=mContext;
//    }
//
//    @Override
//    public int getCount() {
//        return list!=null?list.size():0;
//    }
//
//    //判断是否是否为同一张图片，这里返回方法中的两个参数做比较就可以
//    @Override
//    public boolean isViewFromObject(View view, Object object) {
//        return view==object;
//    }
//    //设置viewpage内部东西的方法，如果viewpage内没有子空间滑动产生不了动画效果
//    @Override
//    public Object instantiateItem(ViewGroup container, int position) {
//        final FrescoImage mFrescoImage = new FrescoImage(mContext);
//        final BeanThemeIe mBeanThemeIe=list.get(position);
//        mFrescoImage.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                if(onItemClickListener!=null){
//                    onItemClickListener.onItemClickListener(mBeanThemeIe);
//                }
//            }
//        });
//       // FrescoUtils.getInstance().setProgressLoad(mContext,textView,list.get(position));
//        container.addView(mFrescoImage, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
//        //最后要返回的是控件本身
//        FrescoUtils.getInstance().setPrefixProgressLoad(mContext,mFrescoImage,mBeanThemeIe.getIeshowimg());
//        return mFrescoImage;
//    }
//    //因为它默认是看三张图片，第四张图片的时候就会报错，还有就是不要返回父类的作用
//    @Override
//    public void destroyItem(ViewGroup container, int position, Object object) {
//        container.removeView((View) object);
//        //         super.destroyItem(container, position, object);
//    }

//    private OnItemClickListener onItemClickListener;
//
//
//
//    public interface OnItemClickListener{
//        void onItemClickListener(BeanThemeIe mBeanThemeIe);
//    }
//
//
//    public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
//        this.onItemClickListener = onItemClickListener;
//    }
}
